import {WeaForm} from 'comsMobx'
import {observable, action, toJS} from 'mobx';
import {WeaLocaleProvider, WeaTools} from "ecCom";
import {Modal} from "antd";
import * as conLockApi from "../apis/contractLockSend";

const getLabel = WeaLocaleProvider.getLabel;
class Initialization {
    @observable dateresult = [];
    @observable loading = false;

    setInitialization = (url, params) => {
        const _this = this;
        Modal.confirm({
            title: getLabel(131329, "确认信息"),
            content: getLabel(508432, "确定初始化吗？"),
            onOk() {
                _this.doInitialization(url, params);
            }
        });
    }
    doInitialization=(url,params)=> {
        this.dateresult = [];
        this.loading = true;//加载中
        // this.clearstore();
        // this.alldatas.form.resetForm();
        WeaTools.callApi(`/api/contractlock/get/initialization`, 'POST',params ).then(result => {
            this.loading = false;//加载结束
            if(result.status==1) {//初始化成功
                this.dateresult = result.data;
                console.log(result.data)
            } else {
                Modal.error({
                    title: getLabel(15172, "系统提示"),
                    content: getLabel(125960, "初始失败")+"!",
                    okText: getLabel(826, "确定"),
                });
            }

        });
    }
}
export  {Initialization};
